package cn.jobstart.controller;
import cn.jobstart.data.DataUtil;
import cn.jobstart.es.service.IResumeEsService;
import cn.jobstart.web.common.SkJsonResult;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.RestController;
import cn.jobstart.pubInter.exception.SkException;
import cn.jobstart.pubInter.IBaseService;
import cn.jobstart.pubInter.RestfulController;
import cn.jobstart.dto.ResumeEducationalExperienceDTO;
import cn.jobstart.dto.ResumeEducationalExperiencePageDTO;
import cn.jobstart.modelExt.ResumeEducationalExperienceExt;
import cn.jobstart.searchExt.ResumeEducationalExperienceSearchExt;
import cn.jobstart.service.IResumeEducationalExperienceService;
import cn.jobstart.vo.ResumeEducationalExperienceDetailVO;
import cn.jobstart.vo.ResumeEducationalExperienceListVO;
import cn.jobstart.vo.ResumeEducationalExperienceDomainVO;
import cn.jobstart.vo.ResumeEducationalExperienceDetailDomainVO;
import cn.jobstart.export.ResumeEducationalExperienceDomainExport;
import cn.jobstart.controller.ApiManageController;
import org.springframework.validation.annotation.Validated;
import java.util.Set;
import java.util.HashSet;
import cn.jobstart.pubInter.exception.BusinessException;

/**
*    @author sunke
*    @Date 2023-09-06 15:00:21
*    @description ResumeEducationalExperienceController      教育经历
*/
@Api(tags = "人才管理系统-教育经历相关", description = "教育经历相关接口")
@RestController(value ="resumeEducationalExperienceRestfulController")
@RequestMapping("/resumeEducationalExperience/")
@Validated
public class ResumeEducationalExperienceController extends ApiManageController<ResumeEducationalExperienceDTO,ResumeEducationalExperiencePageDTO,ResumeEducationalExperienceExt, ResumeEducationalExperienceSearchExt,ResumeEducationalExperienceDomainVO,ResumeEducationalExperienceDetailDomainVO,ResumeEducationalExperienceDetailVO,ResumeEducationalExperienceListVO,String> {

	@Resource(name = "resumeEducationalExperienceService")
	private IResumeEducationalExperienceService resumeEducationalExperienceService;

	@Resource
	private IResumeEsService resumeEsService;

	@Resource
	private DataUtil dataUtil;

	@Override
	public IBaseService<ResumeEducationalExperienceExt, ResumeEducationalExperienceSearchExt,String> getBaseService() throws SkException {
		return resumeEducationalExperienceService;
	}



	@Override
	public void afterPostAdd(ResumeEducationalExperienceDTO dto, ResumeEducationalExperienceExt domain, ResumeEducationalExperienceDetailVO resumeEducationalExperienceDetailVO, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostAdd(dto, domain, resumeEducationalExperienceDetailVO, request, session);

		resumeEsService.publishResumeEducationalExperienceByResumeId(domain.getResumesId());
	}

	@Override
	public void afterPostMod(ResumeEducationalExperienceDTO dto, ResumeEducationalExperienceExt domain, SkJsonResult<ResumeEducationalExperienceDetailVO> jsonResult, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostMod(dto, domain, jsonResult, request, session);
		resumeEsService.publishResumeEducationalExperienceByResumeId(domain.getResumesId());
	}

	@Override
	public String getBaseRoute() {
		return "/resumeEducationalExperience/";
	}

	/**
	* 当前模板名称
	* @return
	*/
	@Override
	public String getModelName(){
		return "教育经历";
	}

	@Override
	public Class exportExcelClass() {
		return ResumeEducationalExperienceDomainExport.class;
	}

	@Override
	public Set<String> totalMapSet() {
		Set totalMapSet=new HashSet();
		totalMapSet.add("count(resume_educational_experience.ree_id) as countNum");
		return totalMapSet;
	}


}